home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 2.iso / dist / fw_libiconv.idb / usr / freeware / include / iconv.h.z / iconv.h
C/C++ Source or Header  |  2001-04-12  |  4KB  |  113 lines

  1. /* Copyright (C) 1999-2001 Free Software Foundation, Inc.
  2.    This file is part of the GNU ICONV Library.
  3.  
  4.    The GNU ICONV Library is free software; you can redistribute it and/or
  5.    modify it under the terms of the GNU Library General Public License as
  6.    published by the Free Software Foundation; either version 2 of the
  7.    License, or (at your option) any later version.
  8.  
  9.    The GNU ICONV Library is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12.    Library General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU Library General Public
  15.    License along with the GNU ICONV Library; see the file COPYING.LIB.  If not,
  16.    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.    Boston, MA 02111-1307, USA.  */
  18.  
  19. /* When installed, this file is called "iconv.h". */
  20.  
  21. #ifndef _LIBICONV_H
  22. #define _LIBICONV_H
  23.  
  24. #define _LIBICONV_VERSION 0x0106    /* version number: (major<<8) + minor */
  25. extern int _libiconv_version;       /* Likewise */
  26.  
  27. /* We would like to #include any system header file which could define
  28.    iconv_t, 1. in order to eliminate the risk that the user gets compilation
  29.    errors because some other system header file includes /usr/include/iconv.h
  30.    which defines iconv_t or declares iconv after this file, 2. when compiling
  31.    for LIBICONV_PLUG, we need the proper iconv_t type in order to produce
  32.    binary compatible code.
  33.    But gcc's #include_next is not portable. Thus, once libiconv's iconv.h
  34.    has been installed in /usr/local/include, there is no way any more to
  35.    include the original /usr/include/iconv.h. We simply have to get away
  36.    without it.
  37.    Ad 1. The risk that a system header file does
  38.    #include "iconv.h"  or  #include_next "iconv.h"
  39.    is small. They all do #include <iconv.h>.
  40.    Ad 2. The iconv_t type is a pointer type in all cases I have seen. (It
  41.    has to be a scalar type because (iconv_t)(-1) is a possible return value
  42.    from iconv_open().) */
  43.  
  44. /* Define iconv_t ourselves. */
  45. #undef iconv_t
  46. #define iconv_t libiconv_t
  47. typedef void* iconv_t;
  48.  
  49. /* Get size_t declaration. */
  50. #include <stddef.h>
  51.  
  52. /* Get errno declaration and values. */
  53. #include <errno.h>
  54. /* Some systems, like SunOS 4, don't have EILSEQ. On these systems, define
  55.    EILSEQ ourselves, but don't define it as EINVAL, because iconv() callers
  56.    want to distinguish EINVAL and EILSEQ. */
  57. #ifndef EILSEQ
  58. #define EILSEQ ENOENT
  59. #endif
  60.  
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66.  
  67. /* Allocates descriptor for code conversion from encoding `fromcode' to
  68.    encoding `tocode'. */
  69. #ifndef LIBICONV_PLUG
  70. #define iconv_open libiconv_open
  71. #endif
  72. extern iconv_t iconv_open (const char* tocode, const char* fromcode);
  73.  
  74. /* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes
  75.    starting at `*inbuf', writing at most `*outbytesleft' bytes starting at
  76.    `*outbuf'.
  77.    Decrements `*inbytesleft' and increments `*inbuf' by the same amount.
  78.    Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */
  79. #ifndef LIBICONV_PLUG
  80. #define iconv libiconv
  81. #endif
  82. extern size_t iconv (iconv_t cd,  char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);
  83.  
  84. /* Frees resources allocated for conversion descriptor `cd'. */
  85. #ifndef LIBICONV_PLUG
  86. #define iconv_close libiconv_close
  87. #endif
  88. extern int iconv_close (iconv_t cd);
  89.  
  90.  
  91. #ifndef LIBICONV_PLUG
  92.  
  93. /* Nonstandard extensions. */
  94.  
  95. /* Control of attributes. */
  96. #define iconvctl libiconvctl
  97. extern int iconvctl (iconv_t cd, int request, void* argument);
  98.  
  99. /* Requests for iconvctl. */
  100. #define ICONV_TRIVIALP            0  /* int *argument */
  101. #define ICONV_GET_TRANSLITERATE   1  /* int *argument */
  102. #define ICONV_SET_TRANSLITERATE   2  /* const int *argument */
  103.  
  104. #endif
  105.  
  106.  
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110.  
  111.  
  112. #endif /* _LIBICONV_H */
  113.